﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Composite.Data;

public partial class Admin_LCAImpactFactor_Controls_ImpactFactorModal : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public void RefreshComponents(string title)
    {
        //litIFModalHeader.Text = title;

        using (DataConnection conn = new DataConnection())
        {
            var items = (from f in conn.Get<LCA.Data.Flow>()
                         where f.IsDeleted == false
                         orderby f.Name
                         select new
                         {
                             Name = f.Name,
                             Value = f.Id
                         }).ToList();


            ddlIFFlows.DataSource = items;
            ddlIFFlows.DataBind();

            var refItems = (from r in conn.Get<LCA.Data.Reference>()
                            orderby r.Name
                           select new
                           {
                               Name = r.Name,
                               Value = r.Id
                           }).ToList();

            ddlReference.DataSource = refItems;
            ddlReference.DataBind();
            ddlReference.Items.Insert(0, new ListItem("-- Please Select --", "NULL"));
        }
    }
}